Simulation of open-quantum-system dynamics using the quantum Zeno effect