Simulation of positive operator-valued measures and quantum instruments via quantum state-preparation algorithms