The evolution of the population ecosystem is closely related to resources and the environment. Assuming that the environmental capacity of a predator population is positively correlated with the number of prey, and that the prey population has a sheltered effect, we investigated a predator–prey model with a juvenile–adult two-stage structure. The dynamical behaviour of the model was examined from two distinct environmental perspectives, deterministic and stochastic, respectively. For the deterministic model, the conditions for the existence of equilibrium points were obtained by comprehensive use of analytical and geometric methods, and the local and global asymptotic stability of each equilibrium point was discussed. For the stochastic system, the effect of noise intensity on the long-term dynamic behavior of the population was investigated. By constructing appropriate Lyapunov functions, the criteria that determined the extinction of the system and the ergodic stationary distribution were given. Finally, through concrete examples and numerical simulations, the understanding of the dynamic properties of the model was deepened. The results show that an improvement in the predator living environment would lead to the decrease in the prey population, while more prey shelters could lead to the decline or even extinction of predator populations.