Hedge-fund manager Bill Ackman moved to dump his entire stake in J.C. Penney Co., ending a failed bet on the retailer that cost his fund more than $600 million, resulted in the loss of thousands of jobs and left the 1,100-store chain still struggling to right itself.