The specific formula applies only for a first order RC low pass filter. This is derived from its frequency response:
$$H(j\omega)=\frac{1}{1+j\omega RC}$$
The cutoff frequency is defined as the frequency where the amplitude of \$H(j\omega)\$ is \$1\over\sqrt2\$ times the DC amplitude (approximately -3dB, half power point).
$$|H(j\omega_c)|=\frac{1}{\sqrt{1^2+\omega_c^2R^2C^2}}=\frac{1}{\sqrt{2}}\cdot|H(j0)|=\frac{1}{\sqrt{2}}$$
Solve it for \$\omega_c\$ (cutoff angular frequency), you'll get \$1\over RC\$. Divide that by \$2\pi\$ and you get the cutoff frequency \$f_c\$.
If you know the frequency response of your filter, you can apply this method (given that the cutoff frequency is defined as above). Obviously, for high-pass filters for example, you calculate with the value for \$\omega\to \infty\$ as opposed to the DC value (always the maximum of the amplitude response, relative to which there is a 3dB decrease in amplitude at the cutoff frequency.)