Role of carbon and nitrogen in Fe_{2}C and Fe_{2}N from first-principles calculations