Yes because when you are struggling to take care of yourself, piling on vet bills and food and more responsibility, and less social time will really help.
Worrying over another being you are responsible for and thinking less about yourself and your own situation...just might help with depression I would think.
And nothing increases the desire for other people to be sociable with you than walking a dog.
I love my dog but absent my partner's desires, I don't think I would've taken it on. The cost, attention, potential behavioral issues, the prospect of losing them eventually are not for everyone.
Depression hates a moving target. The responsibility for exercising my dog is tremendous for my mental (and physical) health.