Dynamical localization criterion for driven two-level systems