Larry Kramer, the dean of the Stanford Law School since 2004, has announced that he will depart the university to assume the presidency of the William and Flora Hewlett Foundation on Sept. 1.