A Sufficient Criterion for Integrability of Stochastic Many-Body Dynamics and Quantum Spin Chains