Her departure comes as the social media company faces challenges, including a slowdown in ad sales.