Well, whatever the treatment practices for mental illness in Trek, the one thing we can say is that they work.
All crime is considered mental illness in that society. Yet people emerge from the system nicely cured, never repeating an offense to our knowledge. Say, Harry Mudd is his affable self after therapy, capable of coming up with new offenses (sometimes even ones No Man Has Committed Before!) even though forever cured of the need to murder a man in 53 innovative ways, or to blackmail a starship captain with shady dilithium deals, or to circumvent Denebian IP laws, or to operate a spacecraft without license... The sheer volume of crimes committed by Mudd indicates the "penal" system (without any known punitive element to it!) has to deal with lots of cases even if there are few individuals involved, and it deals with those extremely well. Out of supposed trillions, four are considered incurable as of the 2260s!
In contrast, our Starfleet heroes face weekly ordeals that ought to drive them mad within a season or so, yet never appear the worse for the wear. Getting cured of suicidal depression in 42 minutes is not a poor dramatic conceit, it's a prerequisite for the existence of Starfleet as an organization. And somehow it works on techniques that do not involve heavily fortified "penal" asylums. Although solitary confinement or other isolation does appear to play a key role, and is actively used especially on underage patients ("Hero Worship", "The Bonding" etc), to good effect. Clearly, methods alien to us are in use, and work very well indeed.
I gather this advanced psychotherapy (be it a method or a pill) is what makes the UFP so paradaisical, not replicators or stun guns or surveillance systems. It might also make people unlikely to worry about asylums as a therapy practice, since the society would be too far removed from any where asylums still carried negative connotations.
Timo Saloniemi