They may be related in cause and effect but there's a sharp delineation between philosophical pessimism and medically diagnosable depression.
And to say that Buddhism is pessimistic isn't entirely right, either. Pessimism towards the goals of the self, and their chances of bringing lasting happiness maybe. But I see a lot of joy and celebration when I look at Tibetan Buddhist art, for instance. Compassion is obviously a huge value therein as well and I don't think you can reconcile that with pessimism.