It's a piece of advice that is generally expressed rather shallowly, but there can be a kernel of wisdom in it, if you choose your words carefully.
Rather than saying "just choose to be happy", the advice should focus on gratitude. If you ruminate on something, it negatively shifts your perception of things that happen in life. In my opinion, practicing gratitude can be a way to reduce how much you fall into those depressive thought spirals in the first place. It won't prevent them from happening, but the sooner you can put a positive thought into your train of thought, it at least temporarily disrupts it and gives you a chance to refocus on something else.