A federal judge on Friday ruled that the Trump administration must fully restore a program that protects from deportation some young immigrants who were brought to the United States illegally as children, including accepting new applications for the program.