I don't think there's any evidence to suggest that density itself is the cause of higher rates of mental illness. Density is more likely to correlate with exposure to car exhaust, for instance, and programs to care for mentally ill people tend to be located in denser areas. The crushing economic pressures of modern life regardless of location, combined with continued urbanization, seem to me more likely to be the cause than dense urban spaces.