WASHINGTON — The House on Thursday approved sweeping legislation to cut $310 billion from the deficit over the next decade — much of it from programs for the poor — and to shift some of that savings to the Pentagon to stave off automatic military spending cuts scheduled for next year.