Adopting a mean-field description for a two-component atomic Bose-Einstein condensate, we study the statics and dynamics of dark-bright solitons in the presence of localized impurities. We use adiabatic perturbation theory to derive an equation of motion for the dark-bright soliton center. We show that, counterintuitively, an attractive (repulsive) delta-like impurity, acting solely on the bright-soliton component, induces an effective localized barrier (well) in the effective potential felt by the soliton; this way, dark-bright solitons are reflected from (transmitted through) attractive (repulsive) impurities. Our analytical results for the small-amplitude oscillations of solitons are found to be in good agreement with results obtained via a Bogoliubov-de Gennes analysis and direct numerical simulations.