"Sure" in the first usage is an emphatic "yes"; it implies that the second speaker is sure they will like a cup of water. "Sure" in the second usage is a shortening of "sure thing", which in turn is a shortening of "it was a sure thing", implying that no thanks are necessary because the second speaker was certain to perform the action for which ... More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.