The consumer goods giant—which also makes Ben & Jerry’s ice cream—beat second-quarter sales growth expectations.