We derive the equations of quantum mechanics and quantum thermodynamics from the assumption that a quantum system can be described by an underlying classical system of particles. Each component φ
j
of the wave vector is understood as a stochastic complex variable whose real and imaginary parts are proportional to the coordinate and momentum associated with a degree of freedom of the underlying classical system. From the classical stochastic equations of motion, we derive a general equation for the covariance matrix of the wave vector, which turns out to be of the Lindblad type. When the noise changes only the phase of φ
j
, the Schrödinger and the quantum Liouville equations are obtained. The component ψ
j
of the wave vector obeying the Schrödinger equation is related to the stochastic wave vector by
|
ψ
j
|
2
=
⟨
|
ϕ
j
|
2
⟩
.