I don't think there's a universal answer.
For many depressed people, having a dog is a tremendous help: it gives them something to care about, something that depends on them, a reason to keep going. Having a dog forces them to get some exercise and walk in the fresh air and sunlight, all of which are noted as helping alleviate the symptoms of depression. In these situations, the dog can literally be a lifesaver. I have friends who have been pulled back from the brink of suicide by having dogs in their lives.
But there are also cases where a person just does not have the capability to care for a dog. Particularly if the dog has unusually high exercise demands or behavioral issues that the caretaker finds stressful and is unable to handle, and/or where the depressed person self-medicates via substance abuse (again, as some of my friends have), these situations can become frustrating and harrowing.
So I don't have an answer beyond "it depends." I've seen it go both ways. I think that for most people it's worth trying, though, because if it does work then the benefit is tremendous, and if it doesn't... well, hopefully the person realizes that in time to get the dog rehomed without too many problems.
ARCHMX TDCH Pongu the Insane, CD-C, RE, RL1X6, RL2X5, RL3X2 (GSD mix, b. Apr 2010)
Crookytail the Tigerwuff, RL1, ITD (Akita mix, b. Jan 2011)