You can use sample code below:
// Converts IP4 address to country name.
CMS.WebAnalytics.IP2CountryHelper ip2country = new CMS.WebAnalytics.IP2CountryHelper();
string country = ip2country.GetCountryByIp("<IP>");
Since version 5.5 of Kentico CMS IP2CountryHelper class is static. Therefore, you need to use following code instead:
string country = IP2CountryHelper.GetCountryByIp("<IP>");