Data-driven stochastic inversion via functional quantization