A variational multiscale approach to PDE-constrained optimization problems arising in data-driven computational mechanics