EVERYONE has mental health issues. It is only a matter of degree.
There is no black and white line that you can draw between someone who is SAFE and UNSAFE. And someone who is SAFE is not necessarily always going to be so, and neither, necessarily, is someone who is UNSAFE now.
And the simple fact of the matter is, ANYONE who isn't locked up is trusted with other human lives, in proportion to the power they can command.
It's always going to come down to the opinion of the person himself, and hopefully competent medical professionals in the case of airplane pilots, that a person is going to be capable of responsibly handling power until his next examination.
In particular, it's perfectly possible for someone to recover from major depression and be capable of doing as good a job as anyone as a pilot.