There are safe, reliable, and well-understood ways to lose weight. They're not easy, enjoyable, or fast, but they're almost certain to work, excluding other medical conditions.
Depression on the other hand, is far less well understood. It's also far more more difficult to treat and fight, and while weight loss has an effective general solution of eating less and exercising more, no such general solution exists for depression. Plenty of people spend their lives chronically depressed with little to no improvement, despite trying countless medications, forms of therapy, and lifestyle adjustments. The same can't really be said for weight loss.