The understanding and treatment of psychiatric disorders, which are known to be neurobiologically and clinically heterogeneous, could benefit from the data-driven identification of disease subtypes. Here, we report the identification of two clinically relevant subtypes of post-traumatic stress disorder (PTSD) and major depressive disorder (MDD) on the basis of robust and distinct functional connectivity patterns, prominently within the frontoparietal control network and the default mode network. We identified the disease subtypes by analysing, via unsupervised and supervised machine learning, the power-envelope-based connectivity of signals reconstructed from high-density resting-state electroencephalography in four datasets of patients with PTSD and MDD, and show that the subtypes are transferable across independent datasets recorded under different conditions. The subtype whose functional connectivity differed most from those of healthy controls was less responsive to psychotherapy treatment for PTSD and failed to respond to an antidepressant medication for MDD. By contrast, both subtypes responded equally well to two different forms of repetitive transcranial magnetic stimulation therapy for MDD. Our data-driven approach may constitute a generalizable solution for connectome-based diagnosis.