When difficult emotions arise (be it depression, anxiety, anger etc.), compassion meditation is the best remedy. Firstly, one needs to engage the proper attitude to enter into to the practice, and actually the turning of the attitude is a great maturity. Let us say that the emotion is depression, one is feeling sad and in the dumps. The first turn for the practice is the thought, "how lucky, this latent tendency is presenting itself clearly so that i can bring it into the light of compassion and liberate it." This may seem decidedly contrived and campy, especially when one feels bad, but it is important. Now one needs to make the second attitude turn which is the thought, "this feeling isn't unique to me, many billions of beings are feeling depressed and sad, seeing this as the depression and sadness of all, may it be liberated in the light of compassion." With the second attitude turn, one has taken the emotion out of the personal (and whatever personal narrative one has given to it) and gone beyond self. Just doing this is a huge step, and dissolves a clinginess of the emotion. However, one does not avoid the emotion but rather encounters it both nakedly and expansively. Now, just let it be present as an energy (the collective energy we call depression or sadness) and love it. Let it be, and let it be in the presence of love. The last part is easy, it is the turning which takes some practice, and attitude is practice. In fact, many of the great prayers and songs of the past masters are mostly about teaching those who read it the right attitude or view, because that switch is the path to real maturation and experience. If one can take obstacles onto the path, then there remains no obstacles. Everything has the potential to liberate because it is liberated.