I think the relevant legislation is the equality act. Under the previous, disability discrimination, act the rule was any condition, including mental health conditions, which had a significant negative effect on your life for at least two years was to be treated as a disability. I don't think that has changed.
The key word is 'reasonable'. The interpretation of that largely depends on employer infrastructure, the cost relative to the resources of the employer and the nature of the job. Not to be flippant but if you wanted to work from home as a football referee, that would be unreasonable. Similarly, if it was a desk based job but no one else worked from home then it wouldn't be reasonable to expect the employer to put special IT infrastructure in place and / or change everyone's working practices to support your home working. If it was a desk-based job and the company was geared up for homeworking for some people, then you have a much better chance of it being seen as a reasonable request, even if it isn't usual in your particular role.
I work for a very large employer and have an option to work from home whenever I need to for MH reasons. I rarely use it because I get nothing done at home. I also have options such as more flexible working than may otherwise be the case, ie. turn up at midday if I've not slept and being able to take leave at short / no notice if I really need to. Reasonable is still key. If I turn up at midday, I will make that time up over the following week or three. If I want to take leave at short notice then it is reasonable for my employer to expect me to arrange things to reduce the impact on my work as much as possible, if it is so bad you have to drop everything, that is illness, not leave.