Energy and centrality dependence of light nuclei production in relativistic heavy-ion collisions