A DYNAMICAL MODEL FOR THE DISTRIBUTION OF DARK MATTER AND GAS IN GALAXY CLUSTERS