Stability criteria for nonlinear and stochastic dynamical systems