Static and dynamic fusion barriers in heavy-ion reactions